package com.ll.menu.user.cart;

import android.support.annotation.IntDef;

import java.io.Serializable;

/**
 * 购物车事件
 *
 * @author wangheng
 */

public class CartEvent implements Serializable {
    private static final long serialVersionUID = -4810705144682289597L;
    public static final int TYPE_ADD_FOOD = 1;
    public static final int TYPE_REMOVE_FOOD = 2;
    public static final int TYPE_REPLACE_FOOD_LIST = 3;
    public static final int TYPE_APPEND_FOOD_LIST = 4;
    public static final int TYPE_CLEAR_FOOD_LIST = 5;
    public static final int TYPE_CHANGE_FOOD_NUMBER = 6;

    @IntDef({TYPE_ADD_FOOD,
            TYPE_REMOVE_FOOD,
            TYPE_REPLACE_FOOD_LIST,
            TYPE_APPEND_FOOD_LIST,
            TYPE_CLEAR_FOOD_LIST,
            TYPE_CHANGE_FOOD_NUMBER})
    @interface CartEventType{}

    @CartEventType
    private int eventType;

    @CartEventType
    public int getEventType() {
        return eventType;
    }

    private CartEvent(){}

    public static CartEvent createEvent(@CartEventType int type){
        CartEvent event = new CartEvent();
        event.eventType = type;
        return event;
    }
}
